package com.heima.admin.v1.controller;

import com.heima.admin.dto.LoginResultDto;
import com.heima.admin.service.AdUserService;
import com.heima.common.dtos.ResponseResult;
import com.heima.model.admin.dtos.AdUserLoginDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
public class AdUserLoginController {

    @Autowired
    private AdUserService adUserService;

    @PostMapping("/login/in")
    public ResponseResult<LoginResultDto> login(@Valid @RequestBody AdUserLoginDto userLoginDto) {
        LoginResultDto loginResultDto = adUserService.login(userLoginDto);
        return ResponseResult.ok(loginResultDto);
    }

}
